<template>
  <h2>代码编辑器组件</h2>
  <el-button @click="switchType">{{ isEdit?'详情':'编辑' }}</el-button>
  <el-button @click="changeJs">改变代码</el-button>
  <code-editor :is-edit="isEdit" v-model="jsCode" />

</template>
<script setup lang="ts">
import { ref } from 'vue'
import CodeEditor from '@/components/CodeEditor.vue'
const isEdit = ref(true)
const switchType = () => {
  isEdit.value = !isEdit.value
}

const jsCode = ref('console.log')
const changeJs = () => {
  jsCode.value = String(Math.random())
}
</script>
